//
//  NearByViewController.m
//  EarnCommision
//
//  Created by EvanZ on 15/3/15.
//  Copyright (c) 2015年 EC. All rights reserved.
//

#import "NearByViewController.h"

@interface NearByViewController (){
    MKMapView * m_mapView;
}

@end

@implementation NearByViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"附近";
    m_mapView = [[MKMapView alloc]initWithFrame:self.view.frame];
    [self.view addSubview:m_mapView];
    
    m_mapView.showsUserLocation=YES;
    
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];//创建位置管理器
    locationManager.delegate=self;//设置代理
    locationManager.desiredAccuracy=kCLLocationAccuracyBest;//指定需要的精度级别
    locationManager.distanceFilter=1000.0f;//设置距离筛选器
    [locationManager startUpdatingLocation];//启动位置管理器
    MKCoordinateSpan theSpan;
    //地图的范围 越小越精确
    theSpan.latitudeDelta=50;
    theSpan.longitudeDelta=50;
    MKCoordinateRegion theRegion;
    theRegion.center=[[locationManager location] coordinate];
    theRegion.span=theSpan;
    [m_mapView setRegion:theRegion];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
